<?php

namespace Xrfg\Wallet\Common\Console;

use Illuminate\Console\Command;
use App\Models\Withdraw as WithdrawModel;
use Xrfg\Wallet\Common\Jobs\WithdrawJob;

class Withdraw extends Command
{
    public $signature = 'withdraw';

    public $description = '处理提现订单';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        WithdrawModel::where('status', WithdrawModel::STATUS_WAITING)
            ->get()
            ->each(function (WithdrawModel $withdraw) {
                WithdrawJob::dispatch($withdraw)->onQueue('withdraw');
            });
    }
}
